home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 4182 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  51 lines

  1. Path: erich.triumf.ca!bennett
  2. From: bennett@erich.triumf.ca (P.Bennett)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: C type question
  5. Date: 2 Feb 1996 07:35 PST
  6. Organization: TRIUMF: Tri-University Meson Facility
  7. Distribution: world
  8. Message-ID: <2FEB199607353567@erich.triumf.ca>
  9. References: <Pine.SUN.3.91.960202131027.20090A-100000@sun19.cs.cuhk.hk>
  10. NNTP-Posting-Host: ftp.triumf.ca
  11. News-Software: VAX/VMS VNEWS 1.50    
  12.  
  13. In article <Pine.SUN.3.91.960202131027.20090A-100000@sun19.cs.cuhk.hk>, Cheung ming wai <mwcheung@cs.cuhk.hk> writes...
  14. >Hi,
  15. >I've some problems about my following program:
  16. >The program should be run under PC.
  17. >=========
  18. >/* program to find the smallest +ve number */
  19. >#include <stdio.h>
  20. >main(void)
  21. >{
  22. >   long double u, v;
  23. >   u = v = 0.5;
  24. >   while((1+u) > 1)  {
  25. >      v = u;
  26. >      u /= 2;
  27. >   }
  28. >   printf("The smallest number (1+u)>1 is: %e.\n", v);
  29.  
  30. %e just prints a plain float.  For long double, you need %Le.
  31.  
  32.  
  33. Peter Bennett VE7CEI                | Vessels shall be deemed to be in sight
  34. Internet: bennett@triumf.ca         | of one another only when one can be
  35. Packet: ve7cei@ve7kit.#vanc.bc.ca   | observed visually from the other
  36. TRIUMF, Vancouver, B.C., Canada     |                          ColRegs 3(k)
  37. GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.